package com.wuyan.locationdog.help

import com.arcsoft.commonbase.bean.DeviceBeanContent
import com.arcsoft.commonbase.bean.GroupBeanContent
import com.blankj.utilcode.util.GsonUtils
import com.blankj.utilcode.util.SPUtils

object GroupHelp {
    //是否移动分组
    var isMoveGroup = false
    var moveGroupDeviceList:MutableList<DeviceBeanContent>? = null

    var selectGroupBeanContent: GroupBeanContent? = null
    fun setGroupId(groupId: String) {
        SPUtils.getInstance().put("groupId", groupId, true)
    }

    fun getGroupId(): String? {
        return SPUtils.getInstance().getString("groupId", "")
    }

    fun setCurrentGroup(groupBeanContent: GroupBeanContent) {
        SPUtils.getInstance().put("groupBeanContent", groupBeanContent.toString(), true)
    }


    fun getCurrentGroup(): GroupBeanContent? {
        val string = SPUtils.getInstance().getString("groupBeanContent", "")
        if (!string.isNullOrEmpty()) {
            val groupBeanContent = GsonUtils.fromJson<GroupBeanContent>(string, GroupBeanContent::class.java)
            return groupBeanContent
        }
        return null
    }
}